from typing import List

class Solution:
    def findKthPositive(self, arr: List[int], k: int) -> int:
        if arr[0] > k:
            return k
        left, right =  0, len(arr) - 1
        ans = -1
        while left <= right:
            mid = (left + right) // 2
            diff = arr[mid] - mid - 1
            if diff >= k:
                ans = mid
                right = mid - 1
            else:
                left = mid + 1
        
        return len(arr) + k if ans == -1 else ans + k